package com.codefish;

/**
 * 耐久属性附魔书
 *
 * @author codefish
 * @version 1.0
 * @date 2022/05/16 下午 09:14
 */
public class DurableBook extends ToolEnchantBook {
    public DurableBook(Tool item, Integer level) {
        super(item);
        super.name = "耐久附魔书";
        super.attribute = "耐久";
        super.value = 5;
        super.level = level;
    }
    @Override
    public void use() {
        item.use();
        System.out.println("附魔了" + attribute + "，附魔等级为" + level + ",价值为" + itselfValue());
    }

    @Override
    public Integer estimateValue() {
        return itselfValue() + item.estimateValue();
    }

    /**
     * 计算自身附魔价值
     *
     * @return 自身附魔价值
     */
    private Integer itselfValue() {
        return level * value;
    }
}
